<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      template="/web/layout/arearestrita.xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 
	
	<ui:define name="bodyPrincipal">
		<p:panel id="panelAreaRestritaEmpresas" columns="2" style="border-width:0;width:100%">
			<f:facet name="header">
				<h:panelGrid columns="2" style="width:100%">
					<h:panelGrid style="width:100%;text-align:left">
						<h:outputText style="font-size:25px" value="EMPRESAS" />
					</h:panelGrid>
					<h:panelGrid style="width:100%;text-align:right">
						<p:commandLink value="NOVA" 
							action="#{empresaBeanSession.novaEmpresa}"  />	
					</h:panelGrid>
				</h:panelGrid>
			</f:facet>
					<p:dataTable id="dtAreaRestritaEmpresas" paginator="true" rows="20"
					 	emptyMessage="Nenhum Empresa cadastrada" 
					 		style="text-align:center"
					 		value="#{empresaBeanSession.empresasList}" var="emp">
						<p:column style="width:250px" headerText="Nome" 
							filterBy="#{emp.razaoSocial}" filterMatchMode="contains">
							<p:commandLink action="#{empresaBeanSession.abrirEmpresaSelecionada}">
								<h:outputText value="#{emp.razaoSocial}" />
								<f:setPropertyActionListener target="#{empresaBeanSession.empresaSelecionada}" 
									value="#{emp}" />
							</p:commandLink>
						</p:column>
						<p:column style="width:150px" headerText="CNPJ">
							<h:outputText value="#{emp.cnpj}" />
						</p:column>
						<p:column style="width:150px" headerText="Nome Responsavel">
							<h:outputText value="#{emp.nomeResponsavel}" />
						</p:column>
					</p:dataTable>
		</p:panel>
	</ui:define>

</ui:composition>